<template>
<div class="comNoticeListOper">
    <van-popover v-model="showPopover" trigger="click" :actions="actions" @select="onSelect">
        <template #reference>
            <van-icon
            name="ellipsis"
            size="18"
            @click="showPopover = true"
            />
        </template>
    </van-popover>
</div>
</template>
<script>
import {Toast} from 'vant'
export default {
    props:["listId"],
    created(){
        if(this.$route.params.id&&this.$route.params.type!="0"){
            this.actions.splice(0, 1)
        }
    },
    data(){
        return{
            showPopover: false,
            actions: [
              { text: '删除', icon: 'close' },
              { text: '投诉', icon: 'phone-circle-o' },
              { text: '收藏', icon: 'smile-o' },
              { text: '分享', icon: 'smile-comment-o' },
            ],
        }
    },
    methods: {
        async onSelect(action,index) {
            if(this.$route.params.id&&this.$route.params.type!="0"){
            }else{
                if(index==0){
                    const formData={
                        id :this.listId
                    }
                    const res = await this.$api.company.reqDelComNotice(formData)
                    if(res.code==200){
                        Toast.success(res.data);
                        this.$emit("update")
                    }
                }
            }
        },
    },
}
</script>
<style lang="less">
.comNoticeListOper{
    /deep/.van-popover--light .van-popover__content{
        box-shadow:none !important;
        border-radius:none !important;
    }
}
</style>